package hlhj.fhp.burst.adapter

import android.content.Context
import android.support.v4.view.PagerAdapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.github.chrisbanes.photoview.PhotoView
import hlhj.fhp.burst.GlideUtil
import hlhj.fhp.burst.R

/**
 * Created by Never Fear   on 2019\1\29 0029.
Never More....
 */
class PreViewAdpBurst(private val datas:ArrayList<String>,private val c:Context) :PagerAdapter() {
    override fun isViewFromObject(view: View, `object`: Any): Boolean {
        return view==`object`
    }

    override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
//
    }
    override fun instantiateItem(container: ViewGroup, position: Int): Any {
        val view = LayoutInflater.from(c).inflate(R.layout.preview_item_burst, null) as View
        val photoView = view.findViewById<PhotoView>(R.id.photoView) as PhotoView
        GlideUtil.loadImg(c,datas[position],photoView)
        container.addView(view)
        return view
//        return super.instantiateItem(container, position)
    }
    override fun getCount(): Int {
        return datas.size
    }
}